import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'cubit.dart';
import 'state.dart';

class TimerPage extends StatelessWidget {
  final cubit = TimerCubit();

  @override
  Widget build(BuildContext context) {
    return BlocProvider(
        create: (BuildContext context) => cubit,
        child: MaterialApp(
          home: Scaffold(
              appBar: AppBar(
                title: Center(child: Text("hourMeter")),
              ),
              body: Center(child: BlocBuilder<TimerCubit, TimerState>(
                builder: (context, state) {
                  return Column(
                    children: [
                      Text("${state.variable}"),
                      FloatingActionButton(
                        onPressed: () => cubit.addition(),
                        child: Icon(Icons.add),
                      )
                    ],
                  );
                },
              ))),
        ));
  }
}
